package com.mtt.erp.common.excel;

import com.mtt.erp.common.exception.MttErpException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Auther: SJZ    2907374717@qq.com
 * @Date: 2019/5/26 13:26
 * @Description:
 */
public class ExcelUtils {
    public static void importExcelBefore(MultipartFile file) throws MttErpException {
            if (file.isEmpty()) {
                throw new MttErpException("导入数据为空");
            }
            String filename = file.getOriginalFilename();
            if (!StringUtils.endsWith(filename, ".xlsx")) {
                throw new MttErpException("只支持.xlsx类型文件导入");
            }

    }
}
